package zx.x.modules.yshbms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zx.x.common.utils.R;
import zx.x.modules.app.utils.BeanUtils;
import zx.x.modules.yshapp.entity.RaffleEntity;
import zx.x.modules.yshapp.entity.RaffleSignUpUserEntity;
import zx.x.modules.yshapp.entity.RaffleSpecialNameListEntity;
import zx.x.modules.yshapp.vo.RaffleSingUpUserVo;
import zx.x.modules.yshbms.dto.RaffleDto;
import zx.x.modules.yshbms.service.RaffleService;
import zx.x.modules.yshbms.service.RaffleSignUpUserService;
import zx.x.modules.yshbms.service.RaffleSpecialNameListService;

import java.util.*;

/**
 * 抽奖
 */
@RestController
@RequestMapping("yshbms/raffleSignUpUser")
public class RaffleSignUpUserController {
    @Autowired
    private RaffleSignUpUserService raffleSignUpUserService;

    @RequestMapping("/list")
    public R list(RaffleSingUpUserVo vo) {

        Page page = PageHelper.startPage(vo.getPage(), vo.getLimit());
        return R.ok().put("page", raffleSignUpUserService.raffleSignUpUserList(vo))
                .put("pages", page.getPages()).put("total", page.getTotal());
    }

    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id) {
        RaffleSingUpUserVo vo = raffleSignUpUserService.getInfo(id);
        return R.ok().put("raffleSingUpUserVo", vo);
    }

    @RequestMapping("/update")
    public R update(@RequestBody RaffleSignUpUserEntity raffleSignUpUserEntity) {
        raffleSignUpUserService.updateById(raffleSignUpUserEntity);
        return R.ok();
    }
}
